package cd.zhixuan.utils.recycler.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import cd.zhixuan.utils.ReflectTools;


public class RecyclerListHolderAdapter<H extends RecyclerView.ViewHolder, T> extends BaseWarpRecyclerAdapter<H, T> {
    @LayoutRes
    protected int layoutRes;
    @NonNull
    private Class<H> holderClass;

    public RecyclerListHolderAdapter(Context mContext, int layoutRes, @NonNull Class<H> holderClass) {
        super(mContext);
        this.layoutRes = layoutRes;
        this.holderClass = holderClass;
    }

    @Override
    public void onBindsViewHolder(H holder, int position) {

    }

    @Override
    public H onCreateViewHolders(ViewGroup parent, View view, int viewType) {
        return ReflectTools.newInstance(holderClass, new Class[]{View.class}, view);
    }

    @Override
    public int onCreateViewRes() {
        return layoutRes;
    }

}
